package com.mc.servlet;

import com.mc.service.JuryService;
import com.mc.service.impl.JuryServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author fyp
 * 评委删除控制器
 */
@WebServlet("/jurydelete.action")
public class JuryDeleteServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //创建评委逻辑对象
        JuryService juryService=new JuryServiceImpl();
        String jid=req.getParameter("juryid");
        System.out.println(jid);
        //类型转换，将id转换成int类型
        int juryid=Integer.valueOf(jid);
        //调用用户逻辑对象删除用户
        boolean flage= juryService.delete(juryid);
        System.out.println(flage);
        //重定向
        resp.sendRedirect("jurylist.action");

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
